<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.search th{border:1px solid #ccc;background:#E6EFF6;font-weight:normal;}
.search td{border:1px solid #ccc;}
</style>
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/lan.js}"></script>
<script language="javascript" type="text/javascript">
$(function() {
$('th[type="order"]').click(function() {
var order = $(this).attr('field') + '-' + $(this).attr('order');
$('#order').val(order);
$('input[name="search"]').click();
}).css({'cursor': 'pointer', 'color': '#36c'});
var order = $('#order').val().split('-');
var field = $('th[type="order"][field="' + order[0] + '"]');
if (order[1] == 'ASC') {
field.attr('order', 'DESC').text(field.text() + '↑');
} else {
field.attr('order', 'ASC').text(field.text() + '↓');
}
if (order[0] != 'arrival_date') {
$('th[type="order"][field="arrival_date"]').attr('order', 'DESC');
}
var isdblclick=0;
$('[type="ajax_edit"]').dblclick(function() {
if(isdblclick==0)
{
var value = $(this).html();
}
else if(isdblclick==1)
{
var value = $(this).text();
}
isdblclick=1;
//$(this).unbind('dblclick');
//var value = $(this).html();
//alert(value);
$(this).html('');
var textarea = $('<textarea style="width:300px; height:80px;" ondblclick="return false;" >' + value + '</textarea>');

//textarea.select();
var id = $(this).attr('id');
var field = $(this).attr('field');
textarea.blur(function() {

var _self = $(this);
$.post('index.php?app=order&act=ajax_edit&id=' + id, {'field' : field, 'value' : $(this).val()}, function(json) {
if (!json.done) {
alert(json.msg);
} else {
isdblclick=0;
_self.parent().html(nl2br(_self.val()));
//_self.parent().bind('dblclick');
}
}, 'json');
});
$(this).append(textarea);
textarea.focus();
});
});
function init_order(order_id) {
$.get('index.php?app=order&act=init_order&id=' + order_id, function(json) {
location.href = location.href;
}, 'json');
}
function nl2br (str) {
var arr = str.split('\n');
var ret = '';
for (var i = 0; i < arr.length; i++) {
ret += arr[i];
if (i != arr.length - 1) {
ret += '<br>\n';
}
}
return ret;
}
</script>
<link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="sub-body">
	<div id="head">
		<div  id="search">
			<form action="" method="get">
					<table width="80%" cellspacing="0" cellpadding="0" class="search">
						<tr>
							<th width="100">报价编号：</th>
							<td width="200"><input type="text" id="quote_sn" name="quote_sn" class="input-1" value="{$smarty.get.quote_sn}" /></td>
							<th width="100">款&nbsp;&nbsp;&nbsp;&nbsp;号：</th>
							<td width="200"><input type="text" id="style_sn" name="style_sn" class="input-1" value="{$smarty.get.style_sn}" /></td>
							<td width="100">
							<input type="hidden" name="app" value="order" />
							<input type="hidden" name="act" value="{$smarty.get.act}" />
							<input type="submit" name="search" value="查询" class="inquiry" /></td>
						</tr>
					</table>
				</form>
		</div>
	</div>
	<div class="tab_info" id="order_list">
		<div class="tab-title-1"><span>订单列表</span></div>
		<table width="100%" cellspacing="0" cellpadding="0" class="tab-display" id="tab-color1">
			<tr>
				<th width="5%">序号</th>
				<th width="10%" type="order" field="order_create_date" order="ASC">报价日期</th>
				<th width="15%">报价编号</th>
				<th type="order" field="style_sn" order="ASC"  width="15%">款号</th>
				<th width="15%">板号</th>
				<th width="7%">图片</th>
				<th width="10%">跟单</th>
				<th width="15%">件数</th>
				<th width="10%">货期</th>
			</tr>
			<!--{foreach from=$orders item=order key=k name=o}-->
			<tr>
				<td>{$smarty.foreach.o.iteration}</td>
				<td>{$order.quote_time|date}</td>
				<td><a href="{if $order.sample_id}{url app=quote&act=quote_info&sample_id=$order.sample_id}{else}{url app=quote&act=quote_info&order_id=$order.order_id}{/if}" style="color:blue">{$order.quote_sn|default:-}</a></td>
				<td><a href="{url app=order&act=edit&id=$order.order_id}" style="color:blue">{$order.style_sn}</a></td>
				<td><a href="{url app=sample&act=edit&id=$order.sample_id}" style="color:blue">{$order.sample_sn}</a></td>
				<td><a href="{$site_url}/{$order.front_pic}" target="_blank"><img src="{$order.front_pic}" width="80" style="border:none;" alt="图片"/></a></td>
				<td>{$order.merchandiser}</td>
				<td>{$order.quantity|default:0}</td>
				<td><!-- {if $order.quote_check_date} -->{$order.quote_check_date|date}<!-- {/if} --></td>
				
			</tr>
			<!--{/foreach}-->
		</table>
		<div class="page"> {include file=page.html}</div>
	</div>
	<div id="order_info"> </div>
</div>
</body>
</html>
